package cn.com.jonpad.webflux.ctrl;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Optional;

@RestController
public class HelloCtrl {

	@GetMapping
	public Optional<String> index(){
		return Optional.of("Hello");
	}

	@GetMapping("index2")
	public Mono<String> index2(String message){
		return Mono.just("Hello Mono "+message);
	}

	@GetMapping("flux")
	public Flux<String> flux(String message){
		String[] ss = new String[]{"1","2","3"};
		return Flux.fromArray(ss);
	}
}
